-- GENERATED SPELL FOR [Crystalcore Devastator] --


function spell0_20040(pUnit, Event) --@Countercharge,Self--
pUnit:FullCastSpellOnTarget(35035,pUnit)
pUnit:RegisterEvent('Sorts_20040', 16500, 1)
end

function spell1_20040(pUnit, Event) --@Countercharge,n/a--
pUnit:FullCastSpellOnTarget(35039,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_20040', 10293, 1)
end

function spell2_20040(pUnit, Event) --@Knock Away,n/a--
pUnit:FullCastSpellOnTarget(37102,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_20040', 627, 1)
end

function spell3_20040(pUnit, Event) --@Powered Down,Self--
pUnit:FullCastSpellOnTarget(34937,pUnit)
pUnit:RegisterEvent('Sorts_20040', 605, 1)
end

function Sorts_20040(pUnit, Event)
local choix_sorts_20040 = math.random(0, 3)
if choix_sorts_20040 == 0 then
pUnit:RegisterEvent('spell0_20040', 1, 1)
end
if choix_sorts_20040 == 1 then
pUnit:RegisterEvent('spell1_20040', 1, 1)
end
if choix_sorts_20040 == 2 then
pUnit:RegisterEvent('spell2_20040', 1, 1)
end
if choix_sorts_20040 == 3 then
pUnit:RegisterEvent('spell3_20040', 1, 1)
end
end

function mob20040_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_20040', math.random(1500, 3000), 1)
end

function mob20040_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob20040_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob20040_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(20040, 1, 'mob20040_Action')
RegisterUnitEvent(20040, 2, 'mob20040_Leave')
RegisterUnitEvent(20040, 3, 'mob20040_Kill')
RegisterUnitEvent(20040, 4, 'mob20040_Die')
